//
//  VMCPrompt.m
//  vmcshop
//
//  Created by toggle on 15/6/18.
//  Copyright (c) 2015年 idongler. All rights reserved.
//

#import "VMCPrompt.h"

@implementation VMCPrompt

- (instancetype)initWithFrame:(CGRect)frame withBlock:(BtnClick)block;
{
	self = [super initWithFrame:frame];
	if (self)
	{
		_noGoods = [[UIImageView alloc] initWithFrame:CGRectMake(MyWidth/2-50, MyHeight/2-150, 100, 100)];
		self.noGoods.image = [UIImage imageNamed:@"paypal.png"];
		[self addSubview:_noGoods];

		_noGoodsLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetWidth(frame)/2-(CGRectGetWidth(frame)-20)/2, CGRectGetMaxY(_noGoods.frame)+ 10, CGRectGetWidth(frame)-20, 20)];
		self.noGoodsLabel.font = [UIFont systemFontOfSize:15.0f];
		self.noGoodsLabel.textAlignment = NSTextAlignmentCenter;
		self.noGoodsLabel.text = @"购物车快饿扁了T.T";
		[self addSubview:_noGoodsLabel];

		_noticeLabel = [[UILabel alloc] initWithFrame:CGRectMake(MyWidth/2-100, CGRectGetMaxY(_noGoodsLabel.frame), 200, 20)];
		self.noticeLabel.textAlignment = NSTextAlignmentCenter;
		self.noticeLabel.font = [UIFont systemFontOfSize:13.0f];
		self.noticeLabel.text = @"主人快给我挑点宝贝吧";
		[self addSubview:_noticeLabel];

		_noGoodsButton = [UIButton buttonWithType:UIButtonTypeCustom];
		self.noGoodsButton.frame = CGRectMake(MyWidth/2-50, self.noGoodsLabel.frame.origin.y + 20 + 10+20, 100, 30);
		[self.noGoodsButton setAttributedTitle:ATTRIBUTE_STRING(@"去逛逛", 14.0f,[UIColor blackColor]) forState:UIControlStateNormal];
		[self.noGoodsButton.layer setCornerRadius:4];
		[self.noGoodsButton.layer setBorderWidth:1];
		[self.noGoodsButton.layer setBorderColor:[[UIColor colorWithString:@"#999999"] CGColor]];
		[self.noGoodsButton addTarget:self action:@selector(goToShop) forControlEvents:UIControlEventTouchUpInside];
		[self addSubview:_noGoodsButton];

		myBlock = block;
	}
	return self;
}

- (instancetype)initWithView:(UIView *)view
{
	self = [super initWithFrame:view.frame];
	if (self)
	{

	}
	return self;
}

- (void)goToShop
{
	myBlock();
}

- (void)layoutSubviews
{
	[super layoutSubviews];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
